package com.example.springboot.controller;

import cn.hutool.core.collection.CollUtil;
import com.example.springboot.common.Result;
import com.example.springboot.service.AdminOrderService;
import com.example.springboot.service.UserService;
import com.example.springboot.service.YardService;
import com.example.springboot.utils.YardUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author: jyf2000jyf
 * @Date: 2022/5/2
 * @Time: 15:27
 * @Email: 904593011@qq.com
 * @Description:
 **/

@RestController
@RequestMapping("echarts")
public class EchartsController {

    @Autowired
    private AdminOrderService orderService;

    @Autowired
    private YardService yardService;

    @GetMapping("flow")
    public Result initFlow(@RequestParam String date) {
        return Result.success(orderService.initFlow(date));
    }

    @GetMapping("yard")
    public Result initYard(Integer yard) {
        return Result.success(yardService.initYard(yard));
    }

    @GetMapping("singleYard")
    public Result initYardByContainerAndDestination(String containerType, String destination) {
        Integer yard = YardUtils.judgeYard(containerType, destination);
        return Result.success(yardService.initYard(yard));
    }
}
